## 安装
准备：gmp-4.3.2、mpc-0.8.1、mpfr-2.4.2，解压至gcc目录中并改名为gmp、mpc、mpfr
```
gcc_dir="/home/majin/install/gcc_install/bin/gcc-lipo-4.6.0"
gmp_name="gmp-4.3.2"
mpc_name="mpc-0.8.1"
mpfr_name="mpfr-2.4.2"

if [ ! -f "$gmp_name.tar.bz2" ];then
wget https://gcc.gnu.org/pub/gcc/infrastructure/$gmp_name.tar.bz2;
tar -jxvf $gmp_name.tar.bz2
mv $gmp_name $gcc_dir/gmp
fi

if [ ! -f "$mpc_name.tar.gz" ];then
wget https://gcc.gnu.org/pub/gcc/infrastructure/$mpc_name.tar.gz;
tar -zxvf $mpc_name.tar.gz
mv $mpc_name $gcc_dir/mpc
fi

if [ ! -f "$mpfr_name.tar.bz2" ];then
wget https://gcc.gnu.org/pub/gcc/infrastructure/$mpfr_name.tar.bz2;
tar -jxvf $mpfr_name.tar.bz2;
mv $mpfr_name $gcc_dir/mpfr
fi
```
./configure --prefix=/home/majin/install/gcc_install/bin/gcc-lipo-4.6.0 --enable-languages=c,c++,objc,obj-c++,fortran,lto --disable-multilib
make -j$(getconf _NPROCESSORS_ONLN) 
sudo make -j$(getconf _NPROCESSORS_ONLN)  
## 报错
### 出现下列错误
```
../../gcc/doc/cppopts.texi:772: @itemx must follow @item
make[3]: *** [doc/cpp.info] Error 1
make[3]: *** Waiting for unfinished jobs.
```
解决方案：texinfo自动安装版本不兼容，需卸载并手动安装
```
sudo apt-get remove texinfo
wget http://ftp.gnu.org/gnu/texinfo/texinfo-4.13a.tar.gz
tar -zxvf texinfo-4.13a.tar.gz
cd texinfo-4.13
./configure && make && sudo make install
```
### 出现下列错误
```
terminal.o: In function `terminal_end_using_terminal':
/home/majin/install/pkg/texinfo-4.13/info/terminal.c:166: undefined reference to `tputs'
/home/majin/install/pkg/texinfo-4.13/info/terminal.c:175: undefined reference to `tputs'
terminal.o: In function `terminal_goto_xy':
/home/majin/install/pkg/texinfo-4.13/info/terminal.c:235: undefined reference to `tputs'
terminal.o:/home/majin/install/pkg/texinfo-4.13/info/terminal.c:272: more undefined references to `tputs' follow
collect2: error: ld returned 1 exit status
```
解决方案：需要安装或者重装ncurses库
```
sudo apt-get install libncurses5-dev
make clean
./configure && make && sudo make install
```

### 出现下列错误
```
In file included from /usr/include/stdio.h:27:0,
                 from ../.././libgcc/../gcc/tsystem.h:87,
                 from ../.././libgcc/../gcc/libgcc2.c:29:
/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory
In file included from /usr/include/stdio.h:27:0,
                 from ../.././libgcc/../gcc/tsystem.h:87,
                 from ../.././libgcc/../gcc/libgcc2.c:29:
/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directoryIn file included from /usr/include/stdio.h:27:0,
                 from ../.././libgcc/../gcc/tsystem.h:87,
                 from ../.././libgcc/../gcc/libgcc2.c:29:
/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory
```
解决方案：检查是否gcc安装32位的依赖库：libc6-dev-i386，如果没有则允许下列命令
```
sudo apt-get install libc6-dev-i386
```
### 出现下列错误
```
/usr/bin/ld: cannot find crti.o: No such file or directory
```
解决方案：LIBRARY_PATH路径中没有包含x86_64-linux-gnu目录(其中含有crti.o)
```
sudo find /usr/ -name crti*
# 将找到的结果添加到```LIBRARY_PATH```中,如
# echo "export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu" >> ~/.bashrc
source ~/.bashrc
make distclean
# 重复安装步骤
```